package com.lhkj.ct.wechat.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lhkj.ct.base.model.dto.PageQuery;
import com.lhkj.ct.base.model.ro.ActionResult;
import com.lhkj.ct.meta.modules.gauge.model.entity.TblScale;
import com.lhkj.ct.meta.modules.gauge.service.ScaleConfigService;
import com.lhkj.ct.wechat.base.model.vo.JsapiResult;
import com.lhkj.ct.wechat.service.WeChatPayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author : hwx
 * @version ：2.0
 * @Description : 心理服务中心
 * @date : 2024-04-01
 */
@RestController
@RequestMapping("api/wechat/psy/service")
@Api(tags = {"6.心理服务中心"})
public class WxMpPsyServiceController {

    @Resource
    private ScaleConfigService scaleConfigService;

    @Resource
    private WeChatPayService weChatPayService;

    @GetMapping(value = "list")
    @ApiOperation(value = "列表接口")
    public ActionResult<IPage<TblScale>> list(TblScale entity, PageQuery pageQuery) {
        IPage<TblScale> pageInfo = scaleConfigService.selectServicePage(entity, pageQuery);
        return ActionResult.success(pageInfo);
    }

    @GetMapping(value = "{id}/pay")
    @ApiOperation(value = "下单接口")
    public ActionResult<JsapiResult> list(@PathVariable String id) {
        return ActionResult.success(weChatPayService.jsApiOrder(id));
    }

}
